package com.jk;

import com.jk.inter.MyInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Hello world!
 *
 */

@ImportResource("classpath:dubbo_customer.xml")
@SpringBootApplication
public class App 
{
    public static void main( String[] args ) throws Exception{
        //springboot启动命令
        SpringApplication.run(App.class, args);
        System.out.println( "Hello World!" );
    }

    @Configuration
    static class WebMvcConfigurer extends WebMvcConfigurerAdapter {
        //增加拦截器
        public void addInterceptors(InterceptorRegistry registry){
            registry.addInterceptor(new MyInterceptor())    //指定拦截器类
                    .addPathPatterns("/**");        //指定该类拦截的url

        }
    }
}
